package file;

import java.io.File;

//访问一个目录的所有子项
public class ListFileDemo {
    public static void main(String[] args) {
        File dir = new File(".");
        if(dir.isDirectory()){
            System.out.println(dir.getName() +"是目录");
        }
        File[] files = dir.listFiles();
        System.out.println(files.length);
        for (File i:files
             ) {
            System.out.println(i.getName());
        }
    }
}
